---
title: Retrieve hazard groups effective on a date
summary: Loads hazard-group classification records whose effective/expiration date window contains a given date.
status: draft
owner: SAIF Claims BOF team
last_reviewed: 2026-08-21
library: SAIF.Business.Policy
reference_type: embedded
operation_id: OP-POL-001
trigger: Caller invokes clsHazardGroupCollection.GetHazardGroups (or obsolete GetHazardGroupCollection)
---

# Retrieve hazard groups effective on a date

Loads all `HAZARD_GROUP` records active on a given effective date into a read-only `clsHazardGroupCollection`, following the standard BOF collection retrieve pattern.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-POL-001 |
| **Trigger** | Caller invokes `clsHazardGroupCollection.GetHazardGroups(inDataportal, inEffectiveDate)` |
| **Inputs** | Data portal (`inDataportal`), effective date (`inEffectiveDate`) |
| **Outputs** | Populated `clsHazardGroupCollection` |
| **Primary components** | `clsHazardGroupCollection.GetHazardGroups`, `clsHazardGroupCollection.Criteria`, `clsHazardGroup.Load`/`Fill` |
| **Entry point** | `SAIF.Business.Policy\clsHazardGroupCollection.vb` |

## Steps

1. Caller invokes `clsHazardGroupCollection.GetHazardGroups(inDataportal, inEffectiveDate)` (shared/static factory). The older `GetHazardGroupCollection` overload is marked `<Obsolete("Use GetHazardGroups instead.")>` and performs the identical call.
2. A `Criteria` object is constructed with the effective date and passed to `inDataportal.DataAccessLayer.RetrieveObject(...)` — this delegates into the framework's data-portal retrieve lifecycle.
   > **Origin**: The retrieve-object dispatch mechanism is implemented in `clsBusinessCollection` (`SAIF.Framework.Core`) and executed on behalf of this operation.
3. `BeforeRetrieve` builds the request from `MyCriteria.RetrieveSQL` ([SQL-002](../sql/SQL-002-hazard-group-retrieve.md), against [HAZARD_GROUP](../database-tables.md#hazard_group)) and adds parameter `EffectiveDate`.
4. The framework executes the data-portal request.
   > **Origin**: Data-portal request execution is implemented in `SAIF.Framework.Core` and executed on behalf of this operation.
5. `AfterRetrieve` reads the `IDataReader` result; for each row it creates a new `clsHazardGroup`, calls `child.Load(CriteriaObject.DataPortalInfo, Reader)`, and adds it to the collection.
6. `clsHazardGroup.Load` calls `Fill(datareader)` to map ten columns (`HAZARD_GROUP_ID`, `NCCI_HAZARD_GROUP_CODE`, `EFFECTIVE_DATE`, `EXPIRATION_DATE`, `HAZARD_GROUP_SHORT_DESCR`, `HAZARD_GROUP_LONG_DESCR`, `CREATE_DATE`, `CREATE_USER`, `UPDATE_DATE`, `UPDATE_USER`), builds a retrieve-only `Criteria`, and calls `MarkOld()`.
   > **Origin**: `MarkOld()` is a framework state-transition operation implemented in `clsBusinessBase` (`SAIF.Framework.Core`).
   - No business rule IDs are enforced in this path — `IsValid`/`IsSavable` purely delegate to `MyBase`.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([GetHazardGroups called]) --> S1[Build Criteria with EffectiveDate]
	S1 --> S2[RetrieveObject dispatch via data portal]
	S2 --> S3[BeforeRetrieve builds SQL-002 request]
	S3 --> S4[Framework executes data-portal request]
	S4 --> S5[AfterRetrieve reads IDataReader]
	S5 --> S6[Create clsHazardGroup, Load/Fill/MarkOld per row]
	S6 --> EndOk([Return clsHazardGroupCollection])
```

## Failure and edge-case behavior
- No explicit error handling is present in this path beyond the framework's own data-portal exception behavior.*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts.

## Sources
- `SAIF.Business.Policy\clsHazardGroupCollection.vb`
- `SAIF.Business.Policy\clsHazardGroup.vb`
